﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ReportCustomOrFin.aspx.cs" Inherits="FL.WebUI.ReportList.ReportCustomOrFin" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>客户报表打印</title>
    <script src="../Scripts/report/CreateControl.js"></script>
    <script src="../Scripts/report/GRInstall.js"></script>
    <script src="../Scripts/report/GRUtility.js"></script>
    <script src="../Scripts/jquery-2.1.4.min.js"></script>
    <script src="../Scripts/common/jquery.data.js"></script>
     <script type="text/javascript">
         Install_InsertReport();
    </script>
	<script type="text/javascript">
	    var Report;//主
	    var Report1;//子报表客户联
	    var Report2;//子报表财务联
	    var tmpIds = '<%=Request["tmpId"]%>'.split(",");
	    function window_onload() {
	        Report = ReportViewer.Report;
	        //定义报表主对象的属性
	        Report.Font.Point = 9;//所有字体大小
	        Report.DesignPaperWidth = 30;//设计宽度
	        Report.Printer.PaperSize = 256;//8是A3纸张，具体请查看api
	        Report.Printer.PaperWidth = 30; 
	        Report.Printer.PaperLength = 15.2;
	       
	        Report.DesignPaperLength = 15.2;//纸张高度
	        Report.Printer.BottomMargin = 2;
	        Report.Printer.LeftMargin = 0.3;
	        Report.Printer.RightMargin = 0;
	        Report.Printer.TopMargin = 0;
	      
	        //通过程序代码定义报表模板
	        //<<
	        //Report.Clear();
	        //定义报表头
	        DefineReportHeader();
	        //客户联
	        CustomReport();
	        //财务联
	        FinanceReport();
	        
	        //>>

	        //如果要检查定义的模板，可以保存到文件，然后用报表设计器打开查看
	        Report.SaveToFile("d:\\Programs.grf");

	        //启动报表运行
	        ReportViewer.Start();
	    }
        //客户联
	    function CustomReport() {
	        //定义页眉
	        DefinePageHeader();
	        
	        //定义报表头
	        DefineReportHeader1();

	        //定义明细网格
	        DefineDetailGrid();
	    }
	    //财务联
	    function FinanceReport() {
	       
	        //定义报表头
	        DefineReportHeader2();

	        //定义明细网格
	        DefineDetailGrid1();
	    }
	   
	    

	    //定义页眉
	    function DefinePageHeader() {
	        Report1.InsertPageHeader();
	        Report1.PageHeader.Height = 0.0;
	        
	        Report2.InsertPageHeader();
	        Report2.PageHeader.Height = 0.0;
	    }

	    //定义页脚
	    function DefinePageFooter() {
	       
	    }
	    //定义报表头
	    function DefineReportHeader() {
	        var Reportheader = Report.ReportHeaders.Add();
	        // Reportheader.RepeatOnPage = true; //表头每页打印
	        Reportheader.CanGrow = true;
	        Reportheader.CanShrink = true;
	        Reportheader.Height = 4.0;
	        var subReport = Reportheader.Controls.Add(9).AsSubReport; //客户联
	        subReport.Name = 'PrintCustomer';
	        subReport.Height = 1.19;
	        //subReport.Bottom = 5;
	        subReport.Font.Point = 9;
	        subReport.CanShrink = true;
	        subReport.Width = 29;
	        subReport.TextAlign = 34;
	        var subReport1 = Reportheader.Controls.Add(9).AsSubReport; //财务联
	        subReport1.Name = 'PrintFinance';
	        subReport1.Height = 1.19;
	        subReport1.CanShrink = true;
	        subReport1.Width = 29;
	        subReport1.Font.Point = 9;
	        subReport1.Top = 1.19;
	        subReport1.TextAlign = 34;
	        Report1 = subReport.Report;
	        Report1.Font.Point = 9;
	        Report2 = subReport1.Report;
	        Report2.Font.Point = 9;
	        Report1.PrintAsDesignPaper = false;
	       
	        Report2.PrintAsDesignPaper = false;
	       
	    }

	    //定义报表头
	    function DefineReportHeader1() {
	        var Reportheader = Report1.ReportHeaders.Add();
	        Reportheader.NewPage = 2;
	        Reportheader.RepeatOnPage = true;//表头每页打印
	        //Reportheader.Height = 1.38;
	        Reportheader.Height = 3.5;
	        //插入一个静态文本框,显示报表标题文字
	        var StaticBox = Reportheader.Controls.Add(1).AsStaticBox; //GRControlType.grctStaticBox
	        StaticBox.Text = "深圳市华商联物流报关有限公司 报关费月结单";
	        //StaticBox.Center = 1; //GRCenterStyle.grcsHorizontal 使部件框在节中水平方向上居中对齐
	        StaticBox.Font.Point = 15;
	        StaticBox.Font.Bold = true;
	        StaticBox.Top = 1.9;
	        StaticBox.Width = 12;
	        StaticBox.Left = 8;
	        StaticBox.Height = 0.58;

	        ////客户名称+简称
	        var customername = Reportheader.Controls.Add(1).AsStaticBox; //grcontroltype.grctstaticbox
	        customername.Text = "客户："+'<%=customerName%>' + "  " + '（<%=customerShortName+secondCustomer%>）';
	        customername.Left = 0.5;
	        customername.Top = 2.7;
	        customername.Width = 8.5;
	        customername.Height = 0.58;

	        ////结算人
	        var employeename = Reportheader.Controls.Add(1).AsStaticBox; //GRControlType.grctStaticBox
	        employeename.Text = "联系人:"+'<%=jsyName%>';
	        //StaticBox1.TextFormat.TextAlign = 36; //GRTextAlign.grtaMiddleRight 使文本对齐到右端
	        employeename.Left = 11;
	        employeename.Top = 2.7;
	        employeename.Width = 5.5;
	        employeename.Height = 0.58;

	        ////结算人联系电话
	        var tel = Reportheader.Controls.Add(1).AsStaticBox; //GRControlType.grctStaticBox
	        tel.Text = "Tel(Fax):" + '<%=jsyTel%>';
	        //StaticBox1.TextFormat.TextAlign = 36; //GRTextAlign.grtaMiddleRight 使文本对齐到右端
	        tel.Left = 14.5;
	        tel.Top = 2.7;
	        tel.Width = 5.5;
	        tel.Height = 0.58;
	        
	        ////插入对账单号
	        var customerLian = Reportheader.Controls.Add(1).AsStaticBox; //GRControlType.grctStaticBox
	        var tmp_infos = fnGetData("t_customer_fees_tmp", "id=" + tmpIds[0]);
	       
	        customerLian.Text = tmp_infos.data[0].tmp_name + '<%=billNos%>';
	        //StaticBox1.TextFormat.TextAlign = 36; //GRTextAlign.grtaMiddleRight 使文本对齐到右端
	        //WordWrap 自动绕行
	        customerLian.WordWrap = true;
	        customerLian.Left = 20;
	        customerLian.Top = 2.1;
	        customerLian.Border = 1;
	        customerLian.bord = 1;
	        //customerLian.BorderStyles = 2;
	        //customerLian.BorderStyles = 4;
	        customerLian.TextAlign = 34;
	        customerLian.Font.Point = 11;
	        customerLian.BorderStyles = 15;
	        customerLian.PaddingLeft = 1.5;
	        customerLian.PaddingRight = 1.5;
	        customerLian.PaddingTop = 1.5;
	        customerLian.PaddingBottom = 1.5;
	        customerLian.Width = 4.2;
	        customerLian.Height = 1.3;
	        
	       
	        ////第二客户
	        var secondCustomer = Reportheader.Controls.Add(1).AsStaticBox; //GRControlType.grctStaticBox
	        secondCustomer.Text = '<%=customerName%>' + "  " + '（<%=customerShortName+secondCustomer%>）';
	        secondCustomer.TextAlign = 33;
	        //StaticBox1.TextFormat.TextAlign = 36; //GRTextAlign.grtaMiddleRight 使文本对齐到右端
	        secondCustomer.Left = 20;
	        secondCustomer.Height = 0.58;
	        secondCustomer.Top = 1.6;
	        secondCustomer.Width = 7;
	        secondCustomer.Height = 0.58;

	        ////计费
	        var customerLian1 = Reportheader.Controls.Add(1).AsStaticBox; //GRControlType.grctStaticBox
	        customerLian1.Text = '<%=chargeName%>';
	        //StaticBox1.TextFormat.TextAlign = 36; //GRTextAlign.grtaMiddleRight 使文本对齐到右端
	        customerLian1.Left = 25.5;
	        customerLian1.Width = 5.5;
	        customerLian1.Height = 0.58;
	        customerLian1.Top = 2.7;
	        customerLian1.Width = 5.5;
	        customerLian1.Height = 0.58;
	        

	        //插入一个系统变量框,显示页号
	        var PageNoBox = Reportheader.Controls.Add(3).AsSystemVarBox; //GRControlType.grctSystemVarBox
	        PageNoBox.SystemVar = 3; //GRSystemVarType.grsvPageNumber
	        PageNoBox.TextFormat.TextAlign = 34; //GRTextAlign.grtaMiddleRight
	        PageNoBox.Left = 24.38;
	        PageNoBox.Top = 3;
	        PageNoBox.Width = 0.5;
	        PageNoBox.Height = 0.40;

	        //插入一个静态文本框,显示页号与总页数中间的分隔斜线字符'/'
	        var StaticBoxXie = Reportheader.Controls.Add(1).AsStaticBox; //GRControlType.grctStaticBox
	        StaticBoxXie.Text = "/";
	        StaticBoxXie.TextFormat.TextAlign = 36; //GRTextAlign.grtaMiddleCenter
	        StaticBoxXie.Left = 24.68;
	        StaticBoxXie.Top = 3;
	        StaticBoxXie.Width = 0.40;
	        StaticBoxXie.Height = 0.40;

	        //插入另一个系统变量框,显示页数
	        var PageCountBox = Reportheader.Controls.Add(3).AsSystemVarBox; //GRControlType.grctSystemVarBox
	        PageCountBox.SystemVar = 2; //GRSystemVarType.grsvPageCount
	        PageCountBox.Left = 25.08;
	        PageCountBox.Top = 3;
	        PageCountBox.Width = 1.40;
	        PageCountBox.Height = 0.40;
        

	    }
	    //定义报表头
	    function DefineReportHeader2() {
	        var Reportheader = Report2.ReportHeaders.Add();
	        Reportheader.NewPage = 2;
	        Reportheader.RepeatOnPage = true;//表头每页打印
	        //Reportheader.Height = 1.38;
	        Reportheader.Height = 3.5;
	        //插入一个静态文本框,显示报表标题文字
	        var StaticBox = Reportheader.Controls.Add(1).AsStaticBox; //GRControlType.grctStaticBox
	        StaticBox.Text = "深圳市华商联物流报关有限公司 报关费月结单";
	        //StaticBox.Center = 1; //GRCenterStyle.grcsHorizontal 使部件框在节中水平方向上居中对齐
	        StaticBox.Font.Point = 15;
	        StaticBox.Font.Bold = true;
	        StaticBox.Top = 1.9;
	        StaticBox.Width = 12;
	        StaticBox.Left = 8;
	        StaticBox.Height = 0.58;

	        ////客户名称+简称
	        var customername = Reportheader.Controls.Add(1).AsStaticBox; //grcontroltype.grctstaticbox
	        customername.Text = "客户：" + '<%=customerName%>' + "  " + '（<%=customerShortName+secondCustomer%>）';
	        customername.Left = 0.5;
	        customername.Top = 2.7;
	        customername.Width = 8.5;
	        customername.Height = 0.58;

	        ////结算人
	        var employeename = Reportheader.Controls.Add(1).AsStaticBox; //GRControlType.grctStaticBox
	        employeename.Text = "联系人:" + '<%=jsyName%>';
	        //StaticBox1.TextFormat.TextAlign = 36; //GRTextAlign.grtaMiddleRight 使文本对齐到右端
	        employeename.Left = 11;
	        employeename.Top = 2.7;
	        employeename.Width = 5.5;
	        employeename.Height = 0.58;

	        ////结算人联系电话
	        var tel = Reportheader.Controls.Add(1).AsStaticBox; //GRControlType.grctStaticBox
	        tel.Text = "Tel(Fax):" + '<%=jsyTel%>';
	        //StaticBox1.TextFormat.TextAlign = 36; //GRTextAlign.grtaMiddleRight 使文本对齐到右端
	        tel.Left = 14.5;
	        tel.Top = 2.7;
	        tel.Width = 5.5;
	        tel.Height = 0.58;

	        ////插入对账单号
	        var customerLian = Reportheader.Controls.Add(1).AsStaticBox; //GRControlType.grctStaticBox
	        var tmp_infos = fnGetData("t_customer_fees_tmp", "id=" + tmpIds[1]);

	        customerLian.Text = tmp_infos.data[0].tmp_name + '<%=billNos%>';
	        //StaticBox1.TextFormat.TextAlign = 36; //GRTextAlign.grtaMiddleRight 使文本对齐到右端
	        //WordWrap 自动绕行
	        customerLian.WordWrap = true;
	        customerLian.Left = 20;
	        customerLian.Top = 2.1;
	        customerLian.Border = 1;
	        customerLian.bord = 1;
	        //customerLian.BorderStyles = 2;
	        //customerLian.BorderStyles = 4;
	        customerLian.TextAlign = 34;
	        customerLian.Font.Point = 11;
	        customerLian.BorderStyles = 15;
	        customerLian.PaddingLeft = 1.5;
	        customerLian.PaddingRight = 1.5;
	        customerLian.PaddingTop = 1.5;
	        customerLian.PaddingBottom = 1.5;
	        customerLian.Width = 4.2;
	        customerLian.Height = 1.3;


	        ////第二客户
	        var secondCustomer = Reportheader.Controls.Add(1).AsStaticBox; //GRControlType.grctStaticBox
	        secondCustomer.Text = '<%=customerName%>' + "  " + '（<%=customerShortName+secondCustomer%>）';
	        secondCustomer.TextAlign = 33;
	        //StaticBox1.TextFormat.TextAlign = 36; //GRTextAlign.grtaMiddleRight 使文本对齐到右端
	        secondCustomer.Left = 20;
	        secondCustomer.Height = 0.58;
	        secondCustomer.Top = 1.6;
	        secondCustomer.Width = 7;
	        secondCustomer.Height = 0.58;

	        ////计费
	        var customerLian1 = Reportheader.Controls.Add(1).AsStaticBox; //GRControlType.grctStaticBox
	        customerLian1.Text = '<%=chargeName%>';
	        //StaticBox1.TextFormat.TextAlign = 36; //GRTextAlign.grtaMiddleRight 使文本对齐到右端
	        customerLian1.Left = 25.5;
	        customerLian1.Width = 5.5;
	        customerLian1.Height = 0.58;
	        customerLian1.Top = 2.7;
	        customerLian1.Width = 5.5;
	        customerLian1.Height = 0.58;


	        //插入一个系统变量框,显示页号
	        var PageNoBox = Reportheader.Controls.Add(3).AsSystemVarBox; //GRControlType.grctSystemVarBox
	        PageNoBox.SystemVar = 3; //GRSystemVarType.grsvPageNumber
	        PageNoBox.TextFormat.TextAlign = 34; //GRTextAlign.grtaMiddleRight
	        PageNoBox.Left = 24.38;
	        PageNoBox.Top = 3;
	        PageNoBox.Width = 0.5;
	        PageNoBox.Height = 0.40;

	        //插入一个静态文本框,显示页号与总页数中间的分隔斜线字符'/'
	        var StaticBoxXie = Reportheader.Controls.Add(1).AsStaticBox; //GRControlType.grctStaticBox
	        StaticBoxXie.Text = "/";
	        StaticBoxXie.TextFormat.TextAlign = 36; //GRTextAlign.grtaMiddleCenter
	        StaticBoxXie.Left = 24.68;
	        StaticBoxXie.Top = 3;
	        StaticBoxXie.Width = 0.40;
	        StaticBoxXie.Height = 0.40;

	        //插入另一个系统变量框,显示页数
	        var PageCountBox = Reportheader.Controls.Add(3).AsSystemVarBox; //GRControlType.grctSystemVarBox
	        PageCountBox.SystemVar = 2; //GRSystemVarType.grsvPageCount
	        PageCountBox.Left = 25.08;
	        PageCountBox.Top = 3;
	        PageCountBox.Width = 1.40;
	        PageCountBox.Height = 0.40;


        }

	    function DefineReportFooter() {
	        
	    }

	    function DefineDetailGrid() {
	        var tmpId = tmpIds[0];
	       var tmp_infos = fnGetData("t_customer_fees_tmp_infos", "tmp_id=" + tmpId, "sort", "IsDesc");
	       Report1.InsertDetailGrid();
	       Report1.DetailGrid.ColumnTitle.Height = 0.85;
	       Report1.DetailGrid.ColumnTitle.RepeatStyle = 2;
	       Report1.DetailGrid.ColumnContent.Height = 0.85;
	        //Red = 255, Green = 196, Blue = 196
	       // Report.DetailGrid.ColumnContent.AlternatingBackColor = ColorFromRGB(196, 196, 255);
	        //Report.DetailGrid.PrintAdaptFitText =true;
	        //Report.DetailGrid.FixedWidth = false;
	        //定义数据集的各个字段
	       var RecordSet = Report1.DetailGrid.Recordset;
	        for (var i = 0; i < tmp_infos.total; i++) {
	            if (tmp_infos.data[i].custom_name=="日期") {
	              var date=  RecordSet.AddField(tmp_infos.data[i].custom_name, 6);
	              date.Format = "yyMMdd";
	            } else {
	                //if (tmp_infos.data[i].is_count == 1) {
	                //    RecordSet.AddField(tmp_infos.data[i].custom_name, 3);
	                //} else {
	                //    RecordSet.AddField(tmp_infos.data[i].custom_name, 1);
	                //}
	                RecordSet.AddField(tmp_infos.data[i].custom_name, 1);
	            }
	            
	        }
	       

	        var margerNames = [];
	        //定义列
	        //var title1 = Report1.DetailGrid.AddColumn("序", "序", "序", 0.6);
	        
	        //title1.TitleCell.TextAlign = 34;
	        //title1.ContentCell.FreeCell = true;
	        //title1.ContentCell.Controls.RemoveAll();
	        //var SystemVarBox = title1.ContentCell.Controls.Add(3).AsSystemVarBox;
	        //SystemVarBox.Dock = 5;
	        //SystemVarBox.TextAlign = 34;
	        //SystemVarBox.SystemVar = 4;
	        //定义分组
	        var Group = Report1.DetailGrid.Groups.Add();
	        var count_left = 0;//合计距离左侧距离
	        for (var j in tmp_infos.data) {
	            if (tmp_infos.data[j].custom_name != "") {
	                if (tmp_infos.data[j].is_count==0) {
	                    count_left += parseFloat(tmp_infos.data[j].width == "" ? 2 : tmp_infos.data[j].width);
	                }
	                
	                
	                var title = Report1.DetailGrid.AddColumn(tmp_infos.data[j].custom_name, tmp_infos.data[j].custom_name, tmp_infos.data[j].custom_name, tmp_infos.data[j].width == "" ? 2 : tmp_infos.data[j].width);
	                title.FixedWidth = true;
	                title.TitleCell.TextAlign = 34;
	                title.TitleCell.WordWrap = true;
	                title.ContentCell.WordWrap = true;
	                title.ContentCell.TextAlign = 34;
	              
	                //<<定义双层表头
	                if (tmp_infos.data[j].merge_name != "") {
	                    //判断标题是否存在
	                    if( margerNames.toString().indexOf(tmp_infos.data[j].merge_name)==-1){
	                        var ColumnTitleCell1 = Report1.DetailGrid.AddGroupTitle("column" + j.toString(), tmp_infos.data[j].merge_name);
	                        ColumnTitleCell1.TextFormat.TextAlign = 34; //GRTextAlign.grtaMiddleCenter
	                        margerNames.push(tmp_infos.data[j].merge_name);
	                    }
	                    ColumnTitleCell1.EncloseColumn(tmp_infos.data[j].custom_name);           
	                }
	                
	                if (tmp_infos.data[j].is_count == 1) {//有合计的
	                    var summary = Group.Footer.Controls.Add(5).AsSummaryBox; //GRControlType.grctSummaryBox
	                    summary.SummaryFun = 1; //GRSummaryFun.grsfSum
	                    summary.TextAlign = 34;
	                    summary.Format = "0.00";
	                    summary.Width = tmp_infos.data[j].width == "" ? 2 : tmp_infos.data[j].width;
	                    summary.DataField = tmp_infos.data[j].custom_name;
	                    summary.AlignColumn = tmp_infos.data[j].custom_name; //通过对齐到列确定部件框的左边位置与宽度
	                    summary.BorderStyles = 13;
	                    summary.Height = 0.85;
	                }
	            }
	        }
	        Group.Header.Height = 0;
	        //Group.ByFields = "序";
	        Group.Footer.Height = 0.85;
	        var count = Group.Footer.Controls.Add(1).AsStaticBox; //GRControlType.grctStaticBox
	        count.Text = "合计";
	        count.Left = 0.40;
	        count.TextAlign = 34;
	        count.Left = count_left-1.5;
	        count.Width = 1;
	        count.Height = 0.85;
	      
	        
	       

	    }
	    function DefineDetailGrid1() {
	        var tmpId = tmpIds[1];
	        var tmp_infos = fnGetData("t_customer_fees_tmp_infos", "tmp_id=" + tmpId, "sort", "IsDesc");
	        Report2.InsertDetailGrid();
	        Report2.DetailGrid.ColumnTitle.Height = 0.85;
	        Report2.DetailGrid.ColumnTitle.RepeatStyle = 2;
	        Report2.DetailGrid.ColumnContent.Height = 0.85;
	        //Red = 255, Green = 196, Blue = 196
	        // Report.DetailGrid.ColumnContent.AlternatingBackColor = ColorFromRGB(196, 196, 255);
	        //Report.DetailGrid.PrintAdaptFitText =true;
	        //Report.DetailGrid.FixedWidth = false;
	        //定义数据集的各个字段
	        var RecordSet = Report2.DetailGrid.Recordset;
	        for (var i = 0; i < tmp_infos.total; i++) {
	            if (tmp_infos.data[i].custom_name == "日期") {
	                var date = RecordSet.AddField(tmp_infos.data[i].custom_name, 6);
	                date.Format = "yyMMdd";
	            } else {
	                //if (tmp_infos.data[i].is_count == 1) {
	                //    RecordSet.AddField(tmp_infos.data[i].custom_name, 3);
	                //} else {
	                //    RecordSet.AddField(tmp_infos.data[i].custom_name, 1);
	                //}
	                RecordSet.AddField(tmp_infos.data[i].custom_name, 1);
	            }

	        }


	        var margerNames = [];
	        //定义列
	        //var title1 = Report2.DetailGrid.AddColumn("序", "序", "序", 0.6);

	        //title1.TitleCell.TextAlign = 34;
	        //title1.ContentCell.FreeCell = true;
	        //title1.ContentCell.Controls.RemoveAll();
	        //var SystemVarBox = title1.ContentCell.Controls.Add(3).AsSystemVarBox;
	        //SystemVarBox.Dock = 5;
	        //SystemVarBox.TextAlign = 34;
	        //SystemVarBox.SystemVar = 4;
	        //定义分组
	        var Group = Report2.DetailGrid.Groups.Add();
	        var count_left = 0;//合计距离左侧距离
	        for (var j in tmp_infos.data) {
	            if (tmp_infos.data[j].custom_name != "") {
	                if (tmp_infos.data[j].is_count == 0) {
	                    count_left += parseFloat(tmp_infos.data[j].width == "" ? 2 : tmp_infos.data[j].width);
	                }


	                var title = Report2.DetailGrid.AddColumn(tmp_infos.data[j].custom_name, tmp_infos.data[j].custom_name, tmp_infos.data[j].custom_name, tmp_infos.data[j].width == "" ? 2 : tmp_infos.data[j].width);
	                title.FixedWidth = true;
	                title.TitleCell.TextAlign = 34;
	                title.TitleCell.WordWrap = true;
	                title.ContentCell.WordWrap = true;
	                title.ContentCell.TextAlign = 34;

	                //<<定义双层表头
	                if (tmp_infos.data[j].merge_name != "") {
	                    //判断标题是否存在
	                    if (margerNames.toString().indexOf(tmp_infos.data[j].merge_name) == -1) {
	                        var ColumnTitleCell1 = Report2.DetailGrid.AddGroupTitle("column" + j.toString(), tmp_infos.data[j].merge_name);
	                        ColumnTitleCell1.TextFormat.TextAlign = 34; //GRTextAlign.grtaMiddleCenter
	                        margerNames.push(tmp_infos.data[j].merge_name);
	                    }
	                    ColumnTitleCell1.EncloseColumn(tmp_infos.data[j].custom_name);
	                }

	                if (tmp_infos.data[j].is_count == 1) {//有合计的
	                    var summary = Group.Footer.Controls.Add(5).AsSummaryBox; //GRControlType.grctSummaryBox
	                    summary.SummaryFun = 1; //GRSummaryFun.grsfSum
	                    summary.TextAlign = 34;
	                    summary.Format = "0.00";
	                    summary.Width = tmp_infos.data[j].width == "" ? 2 : tmp_infos.data[j].width;
	                    summary.DataField = tmp_infos.data[j].custom_name;
	                    summary.AlignColumn = tmp_infos.data[j].custom_name; //通过对齐到列确定部件框的左边位置与宽度
	                    summary.BorderStyles = 13;
	                    summary.Height = 0.85;
	                }
	            }
	        }
	        Group.Header.Height = 0;
	        //Group.ByFields = "序";
	        Group.Footer.Height = 0.85;
	        var count = Group.Footer.Controls.Add(1).AsStaticBox; //GRControlType.grctStaticBox
	        count.Text = "合计";
	        count.Left = 0.40;
	        count.TextAlign = 34;
	        count.Left = count_left - 1.5;
	        count.Width = 1;
	        count.Height = 0.85;
	    }
	</script>
    <style type="text/css">
        html,body {
            margin:0;
            height:100%;
        }
    </style>
</head>
<body style="margin:0" onload="return window_onload()">
	<script type="text/javascript">
	    var tmpId = '<%=Request["tmpId"]%>';
	    var tmpType='<%=Request["tmpType"]%>';
	    var id = '<%=Request["id"]%>';
	    var billNo = "<%=Request["billNo"]%>";
	    var printIds = '<%=printIds%>';
	    var dataUrl = "id=" + id + "&billNo=" + billNo + "&tmpId=" + tmpId + "&tmpType=" + tmpType + "&printIds=" + printIds;
	    CreatePrintViewerEx("100%", "100%", "", encodeURI("../../Report/PrintCustomerAndFin?" + dataUrl), false, "");
	</script>
</body>
</html>
